package pers.xiaoliang.concurrency.example.publish;

import lombok.extern.slf4j.Slf4j;
import pers.xiaoliang.concurrency.annotation.NotRecommend;
import pers.xiaoliang.concurrency.annotation.NotThreadSafe;

import java.util.Arrays;

/**
* @description: 不安全的发布对象
* @author: xiaoliang.liu
* @date: 2018/7/28 13:18
* @version v1.0
*/
@Slf4j
@NotThreadSafe
@NotRecommend
public class UnsagePublish {

    private String[] states = {"a", "b", "d"};

    public String[] getStates() {
        return states;
    }

    public static void main(String[] args) {
        UnsagePublish unsagePublish = new UnsagePublish();
        String[] states = unsagePublish.getStates();

        log.info(Arrays.toString(states));

        // 对数组第一个值进行更改
        states[0] = "n";

        log.info(Arrays.toString(states));

    }
}
